package com.ebupt.migu.music.propagate.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author tz
 */
@Slf4j
@Component
@EnableScheduling
public class PropagateTask {

    @Autowired
    private DetailToRedis detailToRedis;

    @Async("schedule")
    @Scheduled(cron = "${cron.updatePropagate}")
    public void updatePropagate(){
        detailToRedis.updateStrategyStatus();
        detailToRedis.setPropagateToRedis();
    }

    @Async("schedule")
    @Scheduled(cron = "${cron.sendCache}")
    public void sendCache(){
        detailToRedis.sendCache();
    }

}
